import { Directive, ElementRef, Input, OnChanges, Renderer2 } from '@angular/core';

@Directive({
  selector: '[libLibDisableControl]',
  standalone: true
})
export class LibDisableControlDirective implements OnChanges {
  @Input() libLibDisableControl: boolean = false;

  constructor(
    private el: ElementRef,
    private renderer: Renderer2
  ) { }



  ngOnChanges() {
    if (this.libLibDisableControl) {
      this.renderer.setAttribute(this.el.nativeElement, 'disabled', 'true');
    } else {
      this.renderer.removeAttribute(this.el.nativeElement, 'disabled');
    }
  }


}

//<button [libLibDisableControl]="isDisabled">Click Me</button>